////////////////////////////////////////////////////////////////////////////
// Program:  GiTMbot
// Author:   GiTM.soccerist
// Begin-Programming-date: 3/16/04

// Description:  This is a binary bot for login into bnetd chat servers.
//   It was not designed to be fool-proof or broken-proof.  This software is 
//   created "as is" and I can not be responsible for anything that it does
//   to your computer.  Use at your own risk!  
//
// Final words:  
//   As of now there are two hardcoded values in this code (that I am aware of).  The first is the u32 versionByte that is part of packet 0x50 (SID_AUTH_INFO).  The second hardcoded value is the u32 exeVer which is part of packet 0x51 (SID_AUTH_CHECK).  It kinda sucks that it has to be like this and that it must be recompiled each time with the correct values.  If you can fix it, fix it!  
//
//
// TODO's, Notes, & Things to think about:  
//
// 1.   eventually... remove *debug or #define DEBUG_FILE to /dev/null



//#define DEBUG_FILE "debug/debug.out"
#define DEBUG_FILE "/dev/null"

#include<iostream>
#include<fstream>
#include<string>
#include<ctime>

#include "bot/bot.h"

using namespace std;


////////////////////////////////////////////////////////////////////////////
// Globals:
//
// Debug ofstream.
ofstream *debug = new ofstream(DEBUG_FILE);
// This is deallocated at the end of main().
//


int main(int argc, char *argv[]) {
  cout << endl;
  cout << "Welcome to GiTMbot.  " << endl;

  
  // Check the runtime cmd arguments and set the global variables
  // accordingly.  (What settings and run modes.)
  if(argc > 1) {
    for(int i=1; i < argc; i++) {
      if((string(argv[i]) == "--version") || 
	 (string(argv[i]) == "-v")) {
	cout << "GiTMbot version " << VERSION 
	     << " brought to you by GiTM.soccerist" << endl << endl;
	return 0;
      }
      else {
	cerr << "Usage:  GiTMbot [ -v | --version ]" << endl << endl;
	return 1;
      }
    }
  }

  bool keepRunning = true;
  bot druid;

  while(keepRunning == true)
  {
    druid.exec(keepRunning);
    sleep( 30 );
  }

  (*debug).close();

  delete debug;
  cout << "GiTMbot Finished." << endl;
  return 0;
}


